package com.hwj.easybuysys.web;

import com.hwj.easybuysys.model.EbProduct;
import com.hwj.easybuysys.service.EbProductService;
import org.springframework.ui.Model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("prooduct")
public class EbProductController {
    @Autowired
    private EbProductService ebProductService;
    @RequestMapping("detail")
    public String detail(Model model,int epId){
        EbProduct ebProduct = ebProductService.detail(epId);
        model.addAttribute("product",ebProduct);
        return  "product_view";
    }

    @RequestMapping("add_car")
    public String adder(int epId, HttpServletRequest request){
        ebProductService.addCar(epId,request);
        return "shopping";
    }
}
